/**
 * 项目名称（软件名称）：忠旺机械物资管理系统(mms)
 * 研发设计单位：忠旺机械设备制造有限公司机械设计院智能控制设计科设计与研发。
 * 版权所有：忠旺机械设备制造有限公司
 * 注：本项目的一切技术专利，使用规范归解释权由忠旺机械设备制造有限公司所有。
 * 软件版本：Ver 1.0.0
 * 文件路径：com.zhongwang.mms.module.purchase.dao
 * 创建时间：2020年04月24日 18时13分
 **/
package com.zhongwang.mms.module.purchase.dao;

import com.zhongwang.mms.module.purchase.model.VWProject;
import com.zhongwang.mms.module.purchase.model.check.*;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @ClassName： PurCheckDao
 * @Description： 盘点数据持久层
 * @Author： 徐一贺
 * @Date： 2020/4/24 18:13
 * @Version： V1.0
 **/
@Repository
public interface PurCheckDao {
    /**
     *@FunctionName: planList
     *@Description: 盘点计划列表
     *@Author: 徐一贺
     *@CreateDate: 2020/4/24 19:08
     *@Phone: 18241927380
     *@Param: [param] 检索参数
     *@Return: com.zhongwang.mms.common.JsonResult 列表数据
     *@Version: 1.0.0
     */
    List<PCheckPlanModel> findPlanList(PCheckPlanQueryModel param);

    /**
     *@FunctionName: insertCheckPlanSelective
     *@Description: 选择性插入盘点计划数据
     *@Author: 徐一贺
     *@CreateDate: 2020/4/25 10:29
     *@Phone: 18241927380
     * @Param: [param] 插入数据库的盘点计划数据
     * @Return: [void] 空
     * @Version: 1.0.0
     */
    void insertCheckPlanSelective(PCheckPlanModel param);

    /**
     *@FunctionName: updateCheckPlanSelectiveByPrimaryKey
     *@Description: 根据主键选择性更新盘点计划数据
     *@Author: 徐一贺
     *@CreateDate: 2020/4/25 10:29
     *@Phone: 18241927380
     * @Param: [param] 更新进数据库的盘点计划数据
     * @Return: [void] 空
     * @Version: 1.0.0
     */
    void updateCheckPlanSelectiveByPrimaryKey(PCheckPlanModel param);

    /**
     *@FunctionName: findLastIPCOrderCode
     *@Description: 获取最后的编码
     *@Author: 徐一贺
     *@CreateDate: 2020/4/25 10:46
     *@Phone: 18241927380
     *@Param:
     *@Return: [String] 最后的编码
     *@Version: 1.0.0
     */
    String findLastIPCOrderCode();

    /**
     *@FunctionName: getPCheckPlanByByPrimaryKey
     *@Description: 根据主键获取盘点计划信息
     *@Author: 徐一贺
     *@CreateDate: 2020/4/25 10:51
     *@Phone: 18241927380
     *@Param: [cpnId] 主键
     *@Return: [com.zhongwang.mms.module.purchase.model.check.PCheckPlanModel] 盘点假话信息
     *@Version: 1.0.0
     */
    PCheckPlanModel getPCheckPlanByByPrimaryKey(Integer cpnId);
    /**
     *@FunctionName: findDetailList
     *@Description: 根据盘点计划编码获取盘点明细列表
     *@Author: 徐一贺
     *@CreateDate: 2020/4/24 19:07
     *@Phone: 18241927380
     *@Param: [param] 检索参数
     *@Return: com.zhongwang.mms.common.JsonResult 列表数据
     *@Version: 1.0.0
     */
    List<PCheckDetailModel> findDetailList(PCheckDetailQueryModel param);

    /**
     *@FunctionName: getPCheckPlanByByCpnCode
     *@Description: 根据计划编号获取计划
     *@Author: 徐一贺
     *@CreateDate: 2020/4/25 15:43
     *@Phone: 18241927380
     *@Param: [cpnCode] 计划编号
     *@Return: [PCheckPlanModel] 计划
     *@Version: 1.0.0
     */
    PCheckPlanModel getPCheckPlanByByCpnCode(String cpnCode);
    /**
     *@FunctionName: insertCheckDetailSelective
     *@Description: 根据主键选择性新增盘点明细数据
     *@Author: 徐一贺
     *@CreateDate: 2020/4/25 10:29
     *@Phone: 18241927380
     * @Param: [param] 新增进数据库的盘点明细数据
     * @Return: [void] 空
     * @Version: 1.0.0
     */
    void insertCheckDetailSelective(PCheckDetailModel pCheckDetailModel);

    /**
     *@FunctionName: deleteCheckdDetailByPrimaryKey
     *@Description: 根据主键删除盘点明细
     *@Author: 徐一贺
     *@CreateDate: 2020/4/25 16:30
     *@Phone: 18241927380
     *@Param: [cdlId] 主键
     *@Return: [void] 空
     *@Version: 1.0.0
     */
    void deleteCheckDetailByPrimaryKey(Integer cdlId);
    /**
     *@FunctionName: getPCheckrtailCountByCpnId
     *@Description: 根据盘点计划主键和盘点状态获取数据数量
     *@Author: 徐一贺
     *@CreateDate: 2020/4/25 17:48
     *@Phone: 18241927380
     *@Param: [paramMap] 盘点计划主键和盘点状态
     *@Return: [Integer] 盘点数量
     *@Version: 1.0.0
     */
    Integer getPCheckrtailCountByCpnId( Map<String,Integer> paramMap);
    /**
     *@FunctionName: resultList
     *@Description: 盘点结果列表
     *@Author: 徐一贺
     *@CreateDate: 2020/4/24 20:16
     *@Phone: 18241927380
     *@Param: [param] 检索参数
     *@Return: com.zhongwang.mms.common.JsonResult 列表数据
     *@Version: 1.0.0
     */
    List<PCheckDetailModel> findResultList(PCheckDetailQueryModel param);
    /**
     *@FunctionName: updatePCheckDetailCdlNum
     *@Description: 盘点
     *@Author: 徐一贺
     *@CreateDate: 2020/4/27 15:20
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Version:
     */
    void updatePCheckDetailCdlNum(PCheckDetailQueryModel param);
    /**
     *@FunctionName: getPCheckDetailByPrimaryKey
     *@Description: 根据主键获取盘点明细数据
     *@Author: 徐一贺
     *@CreateDate: 2020/4/27 15:20
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Version:
     */
    PCheckDetailModel getPCheckDetailByPrimaryKey(Integer cdlId);

    /**
     *@FunctionName: findPCheckPlanByPrimaryKey
     *@Description: 根据主键导出盘点计划,其实就是导出盘点明细
     *@Author: 徐一贺
     *@CreateDate: 2020/4/27 16:48
     *@Phone: 18241927380
     *@Param: [cpnId] 主键
     *@Return: [List<PCheckPlanModel>] 盘点计划列表
     *@Version: 1.0.0
     */
    List<PCheckDetailExcelModel> findPCheckPlanByPrimaryKey(Integer cpnId);

    /**
     *@FunctionName: resultClean
     *@Description: 清空该计划的盘点结果
     *@Author: 徐一贺
     *@CreateDate: 2020/4/28 10:37
     *@Phone: 18241927380
     *@Param: [param] 计划主键
     *@Return: com.zhongwang.mms.common.JsonResult
     *@Version: 1.0.0
     */
    void resultClean(Integer cpnId);

    /**
     *@FunctionName: findDetailListByCdlCpnId
     *@Description: 根据计划主键获取计划明细
     *@Author: 徐一贺
     *@CreateDate: 2020/4/28 10:51
     *@Phone: 18241927380
     *@Param: [cdlCpnId] 计划主键
     *@Return: [List<PCheckDetailModel>] 计划明细
     *@Version: 1.0.0
     */
    List<PCheckDetailModel> findDetailListByCdlCpnId(Integer cdlCpnId);

    /**
     *@FunctionName: getProjectByCode
     *@Description: 根据项目号获取看板系统实体
     *@Author: 徐一贺
     *@CreateDate: 2020/4/28 13:16
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Version:
     */
    VWProject getProjectByCode(String code);

//    /**
//     *@FunctionName: updateCheckDetailSelectiveByPrimaryKey
//     *@Description: 根据主键更新盘点结果
//     *@Author: 徐一贺
//     *@CreateDate: 2020/4/28 13:36
//     *@Phone: 18241927380
//     *@Param:
//     *@Return:
//     *@Version:
//     */
//    void updateCheckDetailSelectiveByPrimaryKey(PCheckDetailExcelModel data);

    /**
     *@FunctionName: updatePCheckDetailCdlNumAndCdlStatus
     *@Description: 根据主键更新盘点数量和状态
     *@Author: 徐一贺
     *@CreateDate: 2020/4/28 14:12
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Version:
     */
    void updatePCheckDetailCdlNumAndCdlStatus(PCheckDetailExcelModel data);

    /**
     *@FunctionName: insertExcelCheckDetailSelective
     *@Description: 根据导入的Excel新增盘点结果数据
     *@Author: 徐一贺
     *@CreateDate: 2020/4/28 14:18
     *@Phone: 18241927380
     *@Param: [data] 数据
     *@Return: void 空
     *@Version: 1.0.0
     */
    void insertExcelCheckDetailSelective(PCheckDetailExcelModel data);

    /**
     *@FunctionName: getCheckDetailCountByCdlCpnId
     *@Description: 根据计划主键获取明细数量
     *@Author: 徐一贺
     *@CreateDate: 2020/4/28 19:06
     *@Phone: 18241927380
     *@Param: [cdlCpnId] 计划主键
     *@Return: [int] 盘点明细数量
     *@Version: 1.0.0
     */
    int getCheckDetailCountByCdlCpnId(Integer cdlCpnId);

    /**
     *@FunctionName: updatePCheckDetailSelectiveByPrimaryKey
     *@Description: 根据主键选择性更新盘点明细
     *@Author: 徐一贺
     *@CreateDate: 2020/4/28 20:33
     *@Phone: 18241927380
     *@Param: [param] 盘点明细
     *@Return: void 空
     *@Version: 1.0.0
     */
    void updatePCheckDetailSelectiveByPrimaryKey(PCheckDetailModel param);
    /**
     *@FunctionName: adjustExport
     *@Description: 导出盘点损益调整计划
     *@Author: 徐一贺
     *@CreateDate: 2020/4/29 10:11
     *@Phone: 18241927380
     *@Param: [response]
     *@Return: void
     *@Version: 1.0.0
     */
    List<PCheckAdjustExcelModel> findPCheckAdjustExcelBycdlCpnId(Integer cpnId);

    /**
     *@FunctionName: insertPAdjustmentApplyByPrimaryKey
     *@Description: 选择性插入外购件库损益调整申请表数据
     *@Author: 徐一贺
     *@CreateDate: 2020/4/29 12:23
     *@Phone: 18241927380
     *@Param: [pAdjustmentApplyModel] 外购件库损益调整申请表数据
     *@Return: void 空
     *@Version: 1.0.0
     */
    void insertPAdjustmentApplyByPrimaryKey(PAdjustmentApplyModel pAdjustmentApplyModel);

    /**
     *@FunctionName: deletePAdjustmentApplyByAjaCpnId
     *@Description: 根据盘点计划ID删除损益调整表数据
     *@Author: 徐一贺
     *@CreateDate: 2020/4/29 12:34
     *@Phone: 18241927380
     *@Param: [cdlCpnId] 盘点计划ID
     *@Return: [void] 空
     *@Version: 1.0.0
     */
    void deletePAdjustmentApplyByAjaCpnId(Integer cdlCpnId);
    /**
     *@FunctionName: palList
     *@Description: 获得盘点损益表列表
     *@Author: 徐一贺
     *@CreateDate: 2020/4/29 14:16
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Version: 1.0.0
     */
    List<PAdjustmentApplyModel> selectPAdjustmentApplyModelSelectiveByCdlCpnId(PAdjustmentApplyModel param);

    /**
     *@FunctionName: palSumList
     *@Description: 获取汇总表信息
     *@Author: 徐一贺
     *@CreateDate: 2020/4/29 15:58
     *@Phone: 18241927380
     *@Param: [param]
     *@Return: [List<PAdjustmentApplyModel>] 汇总表信息
     *@Version: 1.0.0
     */
    List<PAdjustmentApplyModel> palSumList(PAdjustmentApplyModel param);

    /**
     *@FunctionName: selectPAdjustmentApplyModelSelectiveByPrimaryKeys
     *@Description: 根据主键们获取损益列表
     *@Author: 徐一贺
     *@CreateDate: 2020/5/4 9:59
     *@Phone: 18241927380
     *@Param:
     *@Return:
     *@Version:
     */
    List<PAdjustmentApplyModel> selectPAdjustmentApplyModelSelectiveByPrimaryKeys(String ajaIds);

    /**
     *@FunctionName: updatePCheckDetailPalValByPrimaryKey
     *@Description: 根据主键更改损益差值和备注
     *@Author: 徐一贺
     *@CreateDate: 2020/5/4 12:59
     *@Phone: 18241927380
     *@Param: [param] 主键 损益差值 备注
     *@Return: [void] 空
     *@Version: 1.0.0
     */
    void updatePCheckDetailPalValByPrimaryKey(PCheckDetailModel param);

    /**
     *@FunctionName: updatePAdjustmentApplyModelAjaItyStatus
     *@Description: 根据主键更改申请状态
     *@Author: 徐一贺
     *@CreateDate: 2020/5/4 13:53
     *@Phone: 18241927380
     *@Param: [updateItyStatusModel] 主键与申请状态
     *@Return: [void] 空
     *@Version: 1.0.0
     */
    void updatePAdjustmentApplyModelAjaItyStatus(PAdjustmentApplyModel updateItyStatusModel);

    /**
     *@FunctionName: getCheckDetailCheckCountByCdlCpnId
     *@Description: 根据计划号获取盘点结果中状态为盘点的数据数量
     *@Author: 徐一贺
     *@CreateDate: 2020/5/4 14:56
     *@Phone: 18241927380
     *@Param: [cpnId] 盘点计划主键
     *@Return: [Integer] 盘点数量
     *@Version: 1.0.0
     */
    Integer getCheckDetailCheckCountByCdlCpnId(Integer cpnId);

    /**
     *@FunctionName: deleteCheckDetailByPrimaryKeys
     *@Description: 批量删除盘点明细
     *@Author: 徐一贺
     *@CreateDate: 2020/5/4 16:09
     *@Phone: 18241927380
     *@Param: [cdlIds] 被删除明细的主键
     *@Return: [void] 空
     *@Version: 1.0.0
     */
    void deleteCheckDetailByPrimaryKeys(String cdlIds);
}